package com.hbut.friend.controller.user;

import com.hbut.common.core.Controller.BaseController;
import com.hbut.common.core.constants.HttpConstants;
import com.hbut.common.core.domain.R;
import com.hbut.common.core.domain.TableDataInfo;
import com.hbut.friend.domain.exam.dto.ExamQueryDTO;
import com.hbut.friend.domain.user.dto.ExamDTO;
import com.hbut.friend.service.user.IUserExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/exam")
public class UserExamController extends BaseController {
    @Autowired
    private IUserExamService IUserExamService;
    //报名
    @PostMapping("/enter")
    public R<Void> enter(@RequestHeader(HttpConstants.AUTHENTICATION) String token,@RequestBody ExamDTO examDTO){
        return toR(IUserExamService.enter(token,examDTO.getExamId()));
    }

    @GetMapping("/list") //我的竞赛列表
    public TableDataInfo list(ExamQueryDTO questionQueryDTO) {
         return IUserExamService.list(questionQueryDTO);
    }
}
